<?php

/*
	Class: Commerce_CacheController

	About: Author
		Rich Joslin

	About: License
		<http://communit.as/docs/license>
*/
class Commerce_CacheController extends Cts_Controller_Action_Admin {

	/*
		Function: init
	*/
	function init() {
		parent::init();
	}

	/*
		Function: cleanbytags
	*/
	function cleanbytagsAction() {
		if (!$request->has('tags') || !$request->has('secret')) {
			$this->_redirect("/default/auth/missing");
		} else {
			if ($this->getRequest()->isPost() && $request->secret == Cts_Registry::get('cache_remote_clean_secret_word', 'commerce')) {
				$cache_instance = new Commerce_Cache();
				$this->cache = $cache_instance->factory;
				$this->cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, $request->tags);
			}
		}
	}

}
